package com.anxin.act.task.web;

import java.util.List;

import com.anxin.act.task.entity.WfActRuTask;
import com.anxin.act.task.service.WfActRuTaskService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.anxin.framework.aspectj.lang.annotation.Log;
import com.anxin.framework.aspectj.lang.enums.BusinessType;
import com.anxin.framework.web.controller.BaseController;
import com.anxin.framework.web.entity.AjaxResult;
import com.anxin.common.utils.poi.ExcelUtil;
import com.anxin.framework.web.page.TableDataInfo;

/**
 * 加签任务Controller
 *
 * @author jbs
 * @date 2021-10-22
 */
//@Api(tags = "加签任务" )
@RestController
@RequestMapping("/task/wfActRuTask")
public class WfActRuTaskController extends BaseController{
    @Autowired
    private WfActRuTaskService wfActRuTaskService;

    /**
     * 查询加签任务列表
     */
    //@ApiOperation(value="查询加签任务列表" ,notes="作者:jbs")
    @PreAuthorize("@ss.hasPermi('system:task:view')")
    @GetMapping("/list")
    @Log(title = "查询加签任务列表", businessType = BusinessType.LIST)
    public TableDataInfo<List<WfActRuTask>> list(WfActRuTask wfActRuTask){
        startPage();
        List<WfActRuTask> list = wfActRuTaskService.findList(wfActRuTask);
        return getDataTable(list);
    }

    /**
     * 导出加签任务列表
     */
    //@ApiOperation(value="导出加签任务列表",notes="作者:jbs")
    @PreAuthorize("@ss.hasPermi('system:task:export')")
    @Log(title = "加签任务", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WfActRuTask wfActRuTask) {
        List<WfActRuTask> list = wfActRuTaskService.findList(wfActRuTask);
        ExcelUtil<WfActRuTask> util = new ExcelUtil<WfActRuTask>(WfActRuTask.class);
        return util.exportExcel(list, "task");
    }

    /**
     * 获取加签任务详细信息
     */
    //@ApiOperation(value="获取加签任务详细信息",notes="作者:jbs")
    @PreAuthorize("@ss.hasPermi('system:task:view')")
    @GetMapping(value = "/{id}")
    @Log(title = "获取加签任务详细信息", businessType = BusinessType.LIST)
    public AjaxResult<WfActRuTask> getInfo(@PathVariable("id") String id){
        return AjaxResult.success(wfActRuTaskService.getById(id));
    }

    /**
     * 保存加签任务
     */
    //@ApiOperation(value="保存加签任务",notes="作者:jbs")
    @PreAuthorize("@ss.hasPermi('system:task:edit')")
    @Log(title = "加签任务", businessType = BusinessType.INSERT)
    @PostMapping("/save")
    public AjaxResult save(@RequestBody WfActRuTask wfActRuTask){
        wfActRuTaskService.save(wfActRuTask);
        return AjaxResult.success(wfActRuTask);
    }


    /**
     * 删除加签任务
     */
    //@ApiOperation(value="删除加签任务",notes="作者:jbs")
    @PreAuthorize("@ss.hasPermi('system:task:remove')")
    @Log(title = "加签任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable(("id")) String id){
        return toAjax(wfActRuTaskService.deleteById(id));
    }
}
